package serie;

import java.io.File;
import java.io.IOException;

public class MarkerMain {


	private File aviFile;
	private File parent;

	private void run(String filePath) {
		aviFile = new File(filePath);
		parent = aviFile.getParentFile();
		deletePreviousMarks();
		String bareName = aviFile.getName().replace(".avi", "");
		File mark = new File(parent, bareName + ".mark");
		try {
			mark.createNewFile();
		} catch (IOException e) {
			e.printStackTrace();
			System.exit(1);
		}
	}

	private void deletePreviousMarks() {
		File[] files = parent.listFiles();
		
		for (int i = 0; i < files.length; i++) {
			File current = files[i];
			if (current.getName().endsWith(".mark")) {
				current.delete();
			}
		}
	}

	public static void main(String[] args) {
		new MarkerMain().run(args[0]);
	}
}
